package com.inews.ui;

import com.inews.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;

public class LogoActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// 去除工具栏和标题栏，使页面全屏
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);

		setContentView(R.layout.logo);

		// 设置渐变动画
		ImageView imageLogo = (ImageView) this.findViewById(R.id.img_logo);

		Animation animation = new AlphaAnimation(0.0f, 1.0f); // 0.0 表示完全透明, 1.0 表示完全不透明
		animation.setDuration(4000); // 4秒内执行完毕此动画
		imageLogo.setAnimation(animation);

		// 设置动画监听，在动画结束后进行页面跳转
		animation.setAnimationListener(new AnimationListener() {

			@Override
			public void onAnimationStart(Animation arg0) {

			}

			@Override
			public void onAnimationRepeat(Animation arg0) {

			}

			@Override
			public void onAnimationEnd(Animation arg0) {
				// 跳转至登录页面
				Intent intent = new Intent(LogoActivity.this, LoginActivity.class);
				startActivity(intent);
			}
		});

	}

}
